package com.mas.session.state;

import jade.lang.acl.ACLMessage;

import com.mas.session.Session;

public class FailureExit extends ExitState {

	public FailureExit(Session session) {
		super(session);
	}

	public void notUnderstandMsgContent(ACLMessage message, String reason) {
		session.logInfo("FailureExit.notUnderstandMsgContent()");
		
		ACLMessage replyMsg = message.createReply();
		replyMsg.setContent("Error, I cannot understand the message:"
				+ message.getContent() + ". Reason:" + reason);
		replyMsg.setPerformative(ACLMessage.FAILURE);

		System.out.println(replyMsg.getContent());

		this.session.getAgent().send(replyMsg);
		this.session.setAliveInd(false);
		
		exit(message, "Message not understood");
	}

}